package com.ming.mq.direct;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class DirectMQSender {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void send1(Object msg){
        log.info("one-发送消息:{}",msg);
        rabbitTemplate.convertAndSend(DirectConfig.EXCHANGE, DirectConfig.ROUTINGKEY1,msg);
    }
    public void send2(Object msg){
        log.info("two-发送消息:{}",msg);
        rabbitTemplate.convertAndSend(DirectConfig.EXCHANGE, DirectConfig.ROUTINGKEY2,msg);
    }


}
